package sctu.edu.java.year2016.team01.xuhanmei.day20160521.chapter4_3;

/**
 * Created by Administrator on 2016/5/24.
 * 用while循环求（1+1/2！+1/3！+....+1/20！)的和
 */
public class Sum2 {

    public static void main(String[] args) {

        float i = 1f, j = 1f, sum = 0f, adt = 1f;
        while (i <= 20) {
            while (j <= i) {
                adt = adt * j;
                j++;
            }
            i++;
            sum = sum + 1 / adt;
        }
        System.out.println(sum);
    }
}
